#pragma once

namespace krryn{
namespace view{
	class hardware_buffer{
	public:
		enum lock_type{
			none            = 0, // not locked
			read            = 0x01,
			write           = 0x02,
			read_write      = read | write
		};

		hardware_buffer(size_t a_SizeInBytes);

		void* lock(lock_type a_Type);
		void unlock();
		lock_type locked();

		virtual void write_data(size_t a_Offset, size_t a_SizeInBytes, const void *a_Source) = 0;
		virtual void read_data(size_t a_Offset, size_t a_SizeInBytes, void *a_Destination) = 0;
		size_t get_size_in_bytes() const;
	protected:
		size_t m_SizeInBytes;
		virtual void *lock_impl() = 0;
		virtual void unlock_impl() = 0;
	private:
		lock_type m_Locked;
	};

}
}